package com.bw.controller;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {
    @Autowired
    VoService voService;
    @RequestMapping("list1")
    public Map getlist1(){
        List<Vo> list=voService.getlist1();
        return SugarUtil.getSummaryData(list);
    }
    @RequestMapping("list2")
    public Map getlist2(){
        Double list=voService.getlist2();
        return SugarUtil.getFlipNumberData(list);
    }
    @RequestMapping("list3")
    public Map getlist3(){
        List<Vo1> list=voService.getlist3();
        List<String> list1 = new ArrayList<>();
        list1.add("机构");
        list1.add("完运里程");
        list1.add("完运次数");
        list1.add("完运时长");
        list1.add("每次平均时长");
        list1.add("每次平均里程");
        return SugarUtil.getTablePlayData(list1,list);
    }
    @RequestMapping("list4")
    public Map getlist4(){
        List<Vo> list=voService.getlist4();
        return SugarUtil.getBarData(list);
    }

}
